//
//  UpgradeFinishView.m
//  Router
//
//  Created by teki on 16/3/3.
//  Copyright © 2016年 dc. All rights reserved.
//

#import "UpgradeFinishView.h"


@interface UpgradeFinishView ()
@property (weak, nonatomic) IBOutlet UIView *contentView;

@property (weak, nonatomic) IBOutlet UIButton *finishBtn;
@end


@implementation UpgradeFinishView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/


- (void)awakeFromNib
{
    self.contentView.layer.cornerRadius  = 5.0f;
    self.contentView.layer.masksToBounds = YES;
    
    self.finishBtn.layer.cornerRadius = 5.0f;
    self.finishBtn.layer.masksToBounds = YES;
}


- (IBAction)finishButtonPressed:(id)sender {
    [self dismiss];
}



- (void)showInView:(UIView *)view;
{
    [view addSubview:self];
    [self makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(view);
    }];
}


- (void)dismiss
{
    [UIView animateWithDuration:0.25 animations:^{
        self.alpha = 0.0f;
    } completion:^(BOOL finished) {
        [self removeFromSuperview];
    }];
}

@end
